import {
  formatDate
}
from '@const/filter.js';
import { setProductPrice } from '~/common'
export const C0LUMNS = [{
    width: '150',
    prop: 'productCode',
    label: '产品编码',
    'show-overflow-tooltip': true
  },
  {
    width: '200',
    prop: 'productNameCN',
    label: '产品名称(中)',
    'show-overflow-tooltip': true
  },
  {
    width: '150',
    prop: 'productNameEnglish',
    label: '产品名称(英)',
    'show-overflow-tooltip': true
  },
  {
    width: '150',
    prop: 'specs',
    label: '规格',
    'show-overflow-tooltip': true
  }, //0
  {
    width: '150',
    prop: 'model',
    label: '型号',
    'show-overflow-tooltip': true
  }, //0
  {
    width: '140',
    prop: 'barCode',
    label: '条形码',
    'show-overflow-tooltip': true
  },
  {
    width: '140',
    prop: 'productLineName',
    label: '产品线'
  }, //0
  {
    width: '100',
    prop: 'productUnit',
    label: '单位'
  },
  {
    width: '200',
    prop: 'originalFactoryName',
    label: '生产厂家',
    'show-overflow-tooltip': true
  },
  {
    width: '120',
    prop: 'giftFlag',
    label: '是否赠品',
    formatter: row => (GIFT_FLAG[Number(row.giftFlag)])
  },
  {
    width: '120',
    prop: 'referencePrice',
    label: '单价（元）',
    formatter: row => setProductPrice(row.referencePrice)
  }, //0
  {
    width: '100',
    prop: 'productCount',
    label: '产品数量'
  },
  {
    width: '120',
    prop: 'confirmCount',
    label: '库存配位数量'
  },
  {
    width: '100',
    prop: 'shortSupplyCount',
    label: '欠货数量'
  },
  {
    width: '180',
    prop: 'policyName',
    label: '价格政策'
  },

];
export const GIFT_FLAG = {
  1: '否',
  2: '是',
}
export const CANCEL_C0LUMNS = [{
    width: '150',
    prop: 'productCode',
    label: '产品编码',
    'show-overflow-tooltip': true
  },
  {
    width: '200',
    prop: 'productNameCN',
    label: '产品名称(中)',
    'show-overflow-tooltip': true
  },
  {
    width: '150',
    prop: 'productNameEnglish',
    label: '产品名称(英)',
    'show-overflow-tooltip': true
  },
  {
    width: '150',
    prop: 'specs',
    label: '规格',
    'show-overflow-tooltip': true
  }, //0
  {
    width: '150',
    prop: 'model',
    label: '型号',
    'show-overflow-tooltip': true
  }, //0
  {
    width: '140',
    prop: 'barCode',
    label: '条形码',
    'show-overflow-tooltip': true
  },
  {
    width: '140',
    prop: 'productLineName',
    label: '产品线'
  }, //0
  {
    width: '100',
    prop: 'productUnit',
    label: '单位'
  },
  {
    width: '200',
    prop: 'originalFactoryName',
    label: '生产厂家',
    'show-overflow-tooltip': true
  },

  {
    width: '100',
    prop: 'productCount',
    label: '产品数量'
  }

];
export const DELIVERY_ORDER_C0LUMNS = [{
    width: '200',
    prop: 'productName',
    label: '产品名称(中)',
    'show-overflow-tooltip': true
  },
  {
    width: '160',
    prop: 'productCode',
    label: '产品编码',
    'show-overflow-tooltip': true
  },
  {
    width: '200',
    prop: 'originalFactoryName',
    label: '生产厂家',
    'show-overflow-tooltip': true
  },
  {
    width: '160',
    prop: 'batchNo',
    label: '批号'
  },
  {
    width: '200',
    prop: 'registCode',
    label: '注册证号',
    'show-overflow-tooltip': true
  },
  {
    width: '100',
    prop: 'stockCount',
    label: '库存数量'
  },
  {
    width: '160',
    prop: 'productInvalidDate',
    label: '有效期',
    formatter: row => (formatDate(row.productInvalidDate, 'YYYY-MM-DD'))
  },
  {
    width: '160',
    prop: 'updatedAt',
    label: '配位更新时间'
  },
];
//收货信息
export const RECEIVE_COORDINATION = [{
    width: '160',
    prop: 'deliverCode',
    label: '发货单号'
  },
  {
    width: '160',
    prop: 'deliverDate',
    label: '发货日期'
  },
  {
    width: '100',
    prop: 'deliverCount',
    label: '发货数量'
  },
  {
    width: '160',
    prop: 'productLineName',
    label: '产品线'
  },
  {
    width: '160',
    prop: 'receiveGoodsTime',
    label: '收货日期'
  },
  {
    width: '100',
    prop: 'deliverStatus',
    label: '收货状态',
    formatter: row => (row.deliverStatus ? (Number(row.deliverStatus) === 0 ? '待收货' : '已收货') : '')
  },
  {
    width: '100',
    prop: 'action',
    label: '明细'
  }
];
//收货详情
export const RECEIVE_C0LUMNS = [{
    width: '160',
    prop: 'deliverCode',
    label: '发货单号'
  },
  {
    width: '160',
    prop: 'deliverDate',
    label: '发货日期'
  },
  {
    width: '160',
    prop: 'seqNo',
    label: '序列号'
  },
  {
    width: '160',
    prop: 'productCode',
    label: '产品编码'
  },
  {
    width: '160',
    prop: 'productName',
    label: '产品名称(中)'
  },
  {
    width: '160',
    prop: 'batchNo',
    label: '批号'
  },
  {
    width: '200',
    prop: 'registCode',
    label: '注册证号',
    'show-overflow-tooltip': true
  },
  {
    width: '60',
    prop: 'deliverCount',
    label: '数量'
  },
  {
    width: '100',
    prop: 'deliverPrice',
    label: '单价（元）'
  },
  {
    width: '120',
    prop: '',
    label: '金额小计(元)',
    formatter: row => ((Number(row.deliverCount) * row.deliverPrice).toFixed(2))
  },
  {
    width: '150',
    prop: 'action', //空字段
    label: '摘要'
  }
];
//配送信息
export const SHIPPING_INFORMATION = [{
    width: '150',
    prop: 'transportMode',
    label: '承运方式'
  },
  {
    width: '150',
    prop: 'carrierName',
    label: '物流名称'
  },
  {
    width: '150',
    prop: 'carrierNo',
    label: '物流编号'
  },
  {
    width: '150',
    prop: 'deliveryTime',
    label: '配送时间'
  },
]
//支付信息
export const PAY_INFO = [{
    width: '150',
    prop: 'payCode',
    label: '支付编号'
  },
  {
    width: '150',
    prop: 'paymentType',
    label: '支付方式',
    formatter: row => (PAY_TYPE[Number(row.paymentType)])
  },
  {
    width: '150',
    prop: 'paymentPrice',
    label: '支付金额'
  },
  {
    width: '150',
    prop: 'paymentDate',
    label: '支付时间'
  },
]
export const STOCK_TYPE = {
  '001': '只满足部分库存，客服会尽快联系您',
  '002': '信用账期异常，请尽快联系客服支付订单',
  '003': '信用账期异常，请尽快联系客服支付订单',
  '004': '请尽快联系客服支付订单',
  '005': '押金不足，请尽快联系客服支付订单',
}
const PAY_TYPE = {
  2: '在线支付',
  1: '线下支付',
}